﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace com.dz.ct.ui
{
    public partial class FrmReview : Form
    {
        public FrmReview()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 查询SQL语句
        /// </summary>
        public string BookSQL { get; set; }

        private void btnStart_Click(object sender, EventArgs e)
        {
            string t_sql = string.Empty;
            if (rdoBookSQL.Checked)
            {
                t_sql = txtBookSQL.Text.Trim();
            }
            if (rdoAllBook.Checked)
            {
                t_sql = "select bookId,chapterUrl from tbbook ";
            }
            if (rdoNoReviewBook.Checked)
            {
                t_sql = "select bookId,chapterUrl from tbbook a where not exists(select 1 from tbreview b where a.bookid=b.bookid)";
            }

            if (string.IsNullOrEmpty(t_sql))
            {
                MessageBox.Show("请输入书籍SQL语句", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            BookSQL = t_sql;
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void rdoBookSQL_CheckedChanged(object sender, EventArgs e)
        {
            if (rdoBookSQL.Checked)
            {
                txtBookSQL.Enabled = true;
            }
            else
            {
                txtBookSQL.Enabled = false;
            }
        }
    }
}
